package com.hornet.commons.service;

import java.util.List;

import org.springframework.stereotype.Service;

import com.hornet.commons.web.model.AjaxResponse;
import com.hornet.commons.web.model.DataGrid;

/**
 * 通用接口
 */
@Service
public interface IService<T> {

    T selectByKey(Object key);

    int save(T entity);
    
    int delete(Object key);

    int updateAll(T entity);

    int updateNotNull(T entity);

    List<T> selectByExample(Object example);
    
    AjaxResponse add(T entity) ;
    
    AjaxResponse update(T entity) ;
    
    /**
     * 分页查询
     * selectByPage是mapper.xml中的<select id="selectByPage">
     * @param entity
     * @return
     */
    List<T> selectByPage(T entity) ;
    
    /**
     * 针对EaysUI实现的分页查询
     * @param entity
     * @return
     */
    DataGrid<T> datagrid(T entity) ;
    
    /**
     * 批量删除
     * @param ids 主键
     * @return
     */
    AjaxResponse deleteBatchByKeys(Long[] ids) ;
}
